1. Field of the Invention
The present invention relates to a compiler and a debugging device used for developing programs in an architecture having conditional instructions.
2. Description of the Related Art
Generally, debugging information generated by a compiler contains information used to associate the contents of a source program with the contents of the assembler code translated from it. Of these kinds of information, information on the variables appearing in the source program and the hardware resources (registers and memories) allocated to the variables is called the location information.
In the prior art, location information generated by a compiler has been made up of rows each corresponding to an entry carrying the name of a variable, the resource allocated to the variable, the address at which the resource is valid, and the address at which the resource is invalid.
When the source program shown in FIG. 2 is compiled by a compiler designed for a conventional architecture, the assembler code shown in FIG. 24 is obtained. At this time, the compiler generates, within an assembler file, debugging information containing location information such as shown in FIG. 25. For example, entry 2504 in the location information shown in FIG. 25 shows that a register R1 is assigned as a resource to a variable “a” in the address range from 0x40000022 to 0x40000039. In FIG. 24, 2401 to 2411 indicate assembler instructions, and in FIG. 25, 2501 to 2505 indicate the entries in the location information.
Using an assembler and a linker, an object file in executable form is generated from the assembler file containing the debugging information. A debugging device takes the object file as an input and executes it. While stopping the execution in a step execution mode or by using a breakpoint, the debugging device analyzes the debugging information in response to the user's display request for the contents of a variable, obtains the resource allocated to the variable from the name of the variable and the address at which the execution is stopped, and displays the stored value retrieved from the resource. For example, when the execution is stopped at address 0x4000002D during the debugging, and the user makes a request to the debugging device to display the contents of a variable “b”, the debugging device searches the location information to locate the entry containing the current address 0x4000002D from among the entries for the variable “b”. In the location information of FIG. 25, the entry 2503 corresponds to this entry. Next, resource information is retrieved from that entry to identify the resource allocated to the variable. The entry 2503 in the location information of FIG. 25 shows that the resource allocated to the variable “b” is register R0. The debugging device examines the value held in the resource (in this case, the register R0) and displays this value on the screen as the current value of the variable “b”.
However, if location information similar to the one shown in FIG. 25 is used for a program compiled by a compiler designed for an architecture having conditional instructions, there are certain cases in which the debugging device cannot respond to a user request to display the contents of a variable. If the source program shown in FIG. 2 is complied by a compiler designed for an architecture having conditional instructions, the assembler code shown in FIG. 26 is obtained. Instructions 2603 to 2608 are conditional instructions. In this case, if location information is generated by the prior art debugging information generation method, the location information shown in FIG. 27 is obtained. In FIG. 26, 2601 to 2609 indicate assembler instructions, and in FIG. 27, 2701 to 2705 indicate the entries in the location information.
Suppose that the object file generated from the thus generated assembler code is read into a debugging device for execution, and that, for example, at address 0x4000002B, the user makes a request to the debugging device to display the contents of the variable “a”. In this case, the debugging device searches through the entries for the variable “a” in the location information of FIG. 27, trying to find the entry containing the address 0x4000002B, but in the example shown, two entries 2704 and 2705 are located. As a result, the debugging device cannot determine which of the registers, R0 or R1, is the resource allocated to the variable “a”, and thus it cannot correctly respond to the user' request to display the contents of the variable.